
$(document).ready(function(){


    	     
   $("#updateShopForm").validate({
	
	        rules: {      
	            shopName: { required: true, maxlength: 200},   	          
	            logoURL: {maxlength: 200},
	            vcode: {required: true}

	         },
	         messages: {
	            shopName: { required:"店铺名称不能为空", maxlength: "最大长度不超过200字符"},   
	            logoURL: { maxlength: "最大长度不超过200字符"},  
	            vcode: {required:"验证码不能为空，请输入验证码"}  
	         },
	         submitHandler: function(form) {
	            return true;
	         }
     });
     
    $("#vbox").hide();  
   
   	$("#vcode").click(function(){
      
	    refresh_vcode( edp_domain_url + 'vcode');
	    $("#vbox").show();  
	         
   });    
     
});

function refresh_vcode(url){

  $("#vimg").attr('src',url);

}


function previewIntro(){
	
	// the unblockUI plugin can't handle the iframe correctly, so
	// we have to create the block dialogue ourself here.
	$.blockUI("");
	$("#previewFrame").contents().find("body").html( $("#shopDesc").val() );
	$("#previewFrame").css("border" , "none" );
	
	// make it located in the center of the window
	$("#previewWindow").width("800px");
	$("#previewWindow").height( "500px" );
	$("#previewWindow").css("margin-left" , "-400px");
	$("#previewWindow").css( "margin-top", "-250px" );
	$("#previewWindow").css( "display", "block");
	$("#previewWindow").css( "z-index", "9999");
	$("#previewWindow").css("position" , "absolute");
	$("#previewWindow").css("left" , "50%" );
	$("#previewWindow").css("top" , "50%" );
	$("#previewWindow").css("background" , "white" );
	
	
	
}
function previewLogo(){
   	 $("#shop_pre_pic").attr('src',$("#logoURL").val());
}
function closePreview(){
	UnblockUI(100);
	$("#previewWindow").css( "display", "none");
}



